-
Notifications
You must be signed in to change notification settings - Fork 6
Yuliya_Rock_LL #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Yuliya, you hit the learning goals here. Well done.
constructor() { | ||
// The # before the variable name indicates | ||
// a private variable. | ||
this.#head = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Time Complexity: O(1) | ||
Space Complexity: O(1) | ||
*/ | ||
getFirst() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Very clever use of syntax
Time Complexity: O(1) | ||
Space Complexity: O(1) | ||
*/ | ||
addFirst(value) { | ||
throw new Error("This method hasn't been implemented yet!"); | ||
} | ||
addFirst(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Time Complexity: O(1) | ||
Space Complexity: O(1) | ||
*/ | ||
search(value) { | ||
throw new Error("This method hasn't been implemented yet!"); | ||
search(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 The time complexity is O(n) here since you have to traverse the whole list.
Time Complexity: O(n) | ||
Space Complexity: O(1) | ||
*/ | ||
length() { | ||
throw new Error("This method hasn't been implemented yet!"); | ||
length() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Time Complexity: O(n) | ||
Space Complexity: O(1) | ||
*/ | ||
addLast(value) { | ||
throw new Error("This method hasn't been implemented yet!"); | ||
addLast(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Time Complexity: O(n) | ||
Space Complexity: O(1) | ||
*/ | ||
findMax() { | ||
throw new Error("This method hasn't been implemented yet!"); | ||
findMax() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Time Complexity: O(n) | ||
Space Complexity: O(1) | ||
*/ | ||
delete(value) { | ||
throw new Error('This method has\'t been implemented yet!') | ||
delete(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Time Complexity: O(n) | ||
Space Complexity: O(1) | ||
*/ | ||
visit() { | ||
const helper_list = [] | ||
current = this.#head; | ||
|
||
while (current) { | ||
helper_list.push(current.value); | ||
current = current.next; | ||
} | ||
visit() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Time Complexity: O(n) | ||
Space Complexity: O(1) | ||
*/ | ||
reverse() { | ||
throw new Error("This method hasn't been implemented yet!"); | ||
reverse() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.